﻿@{
    Layout = null;
}
<?xml version="1.0" ?>
<configuration>
    <configSections>
        @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
        {
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>                
        }
        <section name="slickUpload" type="Krystalware.SlickUpload.Configuration.SlickUploadSection, Krystalware.SlickUpload" requirePermission="false" />
    </configSections>
    @RenderSection("custom", false)
    <system.web>
        @if (ViewBag.Project.Language == CodeLanguage.Cs)
        {
        @:<compilation debug="true" @Html.Raw(ViewBag.Project.TargetFramework == FrameworkVersion.NET4 ? "targetFramework=\"4.0\"" : null)>
        }
        else if (ViewBag.Project.Language == CodeLanguage.Vb)
        {
        @:<compilation debug="true" strict="true" explicit="true" @Html.Raw(ViewBag.Project.TargetFramework == FrameworkVersion.NET4 ? "targetFramework=\"4.0\"" : null)>
        }
        @if (ViewBag.Project.TargetFramework >= FrameworkVersion.NET35)
        {
            <assemblies>
                @if (ViewBag.Project.TargetFramework < FrameworkVersion.NET4)
                {
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                }
                @if (ViewBag.Project.MvcVersion == MvcVersion.Mvc1 || ViewBag.Project.MvcVersion == MvcVersion.Mvc2)
                {
                <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />                    
                }
                @if (ViewBag.Project.MvcVersion == MvcVersion.Mvc1)
                {
                <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                }
                else if (ViewBag.Project.MvcVersion == MvcVersion.Mvc2)
                {
                <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                }
                else if (ViewBag.Project.MvcVersion == MvcVersion.Mvc3)
                {
                <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />            
                }
            </assemblies>
        }
        </compilation>
        <!--
                        The <authentication> section enables configuration 
                        of the security authentication mode used by 
                        ASP.NET to identify an incoming user. 
                -->
        <authentication mode="Windows"/>
        <!--
                        The <customErrors> section enables configuration 
                        of what to do if/when an unhandled error occurs 
                        during the execution of a request. Specifically, 
                        it enables developers to configure html error pages 
                        to be displayed in place of a error stack trace.

                <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                        <error statusCode="403" redirect="NoAccess.htm" />
                        <error statusCode="404" redirect="FileNotFound.htm" />
                </customErrors>
                -->
        @if (ViewBag.Project.TargetFramework > FrameworkVersion.NET2)
        {
        <pages>
            @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
            {
            <controls>
              <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
              <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </controls>
            }
            @if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            <namespaces>
                <add namespace="System.Web.Mvc"/>
                <add namespace="System.Web.Mvc.Ajax"/>
                <add namespace="System.Web.Mvc.Html"/>
                <add namespace="System.Web.Routing"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Collections.Generic"/>
                @if (ViewBag.Project.MvcVersion == MvcVersion.Mvc3)
                {
                <add namespace="System.Web.Helpers" />
                <add namespace="System.Web.WebPages"/>
                }
            </namespaces>
            }
        </pages>
        }
        @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
        {
        <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        </httpHandlers>
        }
        <httpModules>
            @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
            {
            @*<remove name="ScriptModule" />
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            *@
            if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            @*<remove name="UrlRoutingModule" />*@
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />                
            }
            }
            <add name="SlickUploadModule" type="Krystalware.SlickUpload.Web.SlickUploadModule, Krystalware.SlickUpload" />
        </httpModules>
    </system.web>
    @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
    {
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
                      type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5" />
                <providerOption name="WarnAsError" value="false" />
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
                      type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="OptionInfer" value="true"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>                
        </compilers>
    </system.codedom>
    }
    
    <!-- 
        The system.webServer section is required for running under IIS 7 integrated mode.
        It is not necessary for previous versions of IIS or the VS.NET WebDev server.
    -->
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
            @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
            {
            <remove name="ScriptModule" />
            }
            @if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            <remove name="UrlRoutingModule" />
            }            
            @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
            {
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            }
            @if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            }
            <add name="SlickUploadModule" type="Krystalware.SlickUpload.Web.SlickUploadModule, Krystalware.SlickUpload" preCondition="integratedMode" />
        </modules>
        @if (ViewBag.Project.TargetFramework == FrameworkVersion.NET35)
        {
        <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory" />
            <remove name="ScriptHandlerFactoryAppServices" />
            <remove name="ScriptResource" />
            @if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            <remove name="UrlRoutingHandler" />                
            }
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            @if (ViewBag.Project.ViewEngine == ViewEngine.Mvc)
            {
            <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            }
        </handlers>
        }
    </system.webServer>

    @RenderBody()

    <!-- Enable large requests to SlickUpload's handler -->
    <location path="SlickUpload.axd">
        <system.webServer>
            <security>
                <requestFiltering>
                    <requestLimits maxAllowedContentLength="2072576000"/>
                </requestFiltering>
            </security>
        </system.webServer>
    </location>

    @if (ViewBag.Project.MvcVersion == MvcVersion.Mvc2)
    {
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    }
    else if (ViewBag.Project.MvcVersion == MvcVersion.Mvc3)
    {
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    }
</configuration>
